#!/bin/bash
#
# Script for cleaning up after cmake builds, as cmake doesn't clean after itself.
#

SCRIPT_DIR=`dirname "$0"`
echo "Cleaning $SCRIPT_DIR..."

make clean 2>/dev/null
find $SCRIPT_DIR -name Makefile | xargs -I {} sh -c 'git ls-files --error-unmatch 1>/dev/null 2>/dev/null {} || rm {}'
find $SCRIPT_DIR -name CMakeCache.txt -exec rm {} \;
find $SCRIPT_DIR -name CMakeFiles -exec rm -rf {} \;
